
<script type="text/javascript">


</script>

<?php
//	pr($jdetail);
 //   pr($uid);
 $today = date("Y-m-d H:i:s");
// echo '<br>';
// echo $today;
//  echo '<br>';
// echo $jdetail[0]['Job']['sdate'];
//  echo '<br>';
?>

<div id="taskdetails">
<header>
    <ul class="action-buttons clearfix fr">
        <li><a href="documentation/index.html" class="button button-gray no-text help" rel="#overlay">Help<span class="help"></span></a></li>
    </ul>
    <h2>Detail View</h2>
</header>

<?php //echo pr($found);?> 
<section>

<fieldset>

    <legend><?php echo $jdetail[0]['Job']['title']?></legend>
        <br />
            <!--<p>Ceated on : <?php echo $jdetail[0]['Job']['created']?></p>
            <p>Last Modified : <?php echo $jdetail[0]['Job']['modified']?></p>-->
            <p><b>Start Date : </b><?php echo $jdetail[0]['Job']['sdate']?></p>
            <p><b>End Date : </b><?php echo $jdetail[0]['Job']['edate']?></p>
            <p><b>Description :</b></p>
            <p><?php echo nl2br($jdetail[0]['Job']['description']) ?></p>
            
            


                <div class="span-4 last">
                    <?php
                    $hasVolunteer = $jdetail[0]['Job']['hasvolunteer'];
                    //echo $hasVolunteer;
                    
                    echo $form->create('Job', array('action' => 'addvol/' . $jdetail[0]['Job']['id']));
                    echo $form->input('User.id', array('type'=>'hidden', 'value' => $uid));
                    //echo $_SESSION['Group'][0]['name'];
                    if($hasVolunteer == 0)
                    {       
                         if($today < $jdetail[0]['Job']['sdate'])
                         {
                             if($qualified == 'Yes' || $_SESSION['Group'][0]['name'] != 'User')
                             {  
                                 echo $form->button('Volunteer', array('class' => 'button'));
                                 echo $form->end();
                             }
                             else
                             {
                                echo 'Your identified skill set does not meet the requirements for this task. If you feel you can complete this task or have questions please contact the ANA office.';
                             }
                         }
                         else
                         {
                             echo $form->button('Task has already passed', array('class' => 'button', 'disabled' => 'disabled'));
                             echo $form->end();
                         }
                    }
                    else
                    {
                        if(isset($jdetail[0]['User'][0]['id']))
                        {
                            if($jdetail[0]['User'][0]['id'] == $uid)
                            {
                            ?>
                                <p><b>Special Instructions :</b></p>
                                <p><?php echo nl2br($jdetail[0]['Job']['hiddendetails']) ?></p>
                                <?php
                                   if($today <= $jdetail[0]['Job']['sdate'])
                                   {
                                    //echo $form->create('Job', array('action' => 'delvol/' . $jdetail[0]['Job']['id']));
                                        echo $form->button('<span class="cancel"></span>Unvolunteer', array('class' => 'button button-gray', 'onclick' => 'location.href=\'' . $this->Html->url('/jobs/delvol/'. $jdetail[0]['Job']['id']) . '\'' , 'type' => 'button'));
                                   // echo $jdetail[0]['Job']['id'];
                                   }
                                   else if($today > $jdetail[0]['Job']['sdate'])
                                   {
                                        echo $form->button('<span class="exclamation"></span>Task has passed', array('class' => 'button button-gray', 'disabled' => 'disabled', 'onclick' => 'location.href=\'' . $this->Html->url('/jobs/delvol/'. $jdetail[0]['Job']['id']) . '\'' , 'type' => 'button'));
                                        echo $form->button('<span class="icon-note"></span>Add Task Notes', array('class' => 'button button-gray', 'onclick' => 'location.href=\'' . $this->Html->url('/jobs/jaddnote/'. $jdetail[0]['Job']['id']) . '\'' , 'type' => 'button'));
                                   }
                                   
                            }
                            else
                            {
                                echo $form->button('<span class="exclamation"></span>Already Filled', array('class' => 'button button-gray', 'disabled' => 'disabled'));
                                echo $form->end();
                            }
                        }
                    }   
                    ?>
                
                </div>
</div>
</fieldset>
</section>
<?php //echo pr($_SESSION);// echo pr($jdetail); ?> 
